<?php
	require_once './handler/check_session.php';	
	require_once './data/Dossier.php';
	
	$nb_creation = $banque->getNbDossierEnDemande();
	$nb_encours = $banque->getNbDossierEnCour();
	$nb_emis = $banque->getNbDossierEmis();
	
	$NB_DOSSIER = 15;

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
        <title>Consultation</title>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
        <link rel="STYLESHEET" type="text/css" href="style/header_footer_style.css" />
        <link rel="STYLESHEET" type="text/css" href="style/main_style.css" />
        <script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
        <script type='text/javascript'>
	        function go(page){
	        	document.getElementById("pageText").innerHTML = "chargement...";
	        	var filtName = document.getElementById("nameFilter").value;
	        	var statusFilter = document.getElementById("statusFilter").value;
	        	var banqueFilter = document.getElementById("banqueFilter") != null ? document.getElementById("banqueFilter").value : "";
	        	$("#main2").load('main.php?page='+page + "&nameFilter=" + filtName + "&statusFilter=" + statusFilter + "&banqueFilter=" + banqueFilter + " #main2"); 
	        }
        </script>
    </head>
    <!-- BODY -->
    <body>
    	<!-- HEADER -->
        <?php include_once'./include/header.php'; ?>
        <!-- MAIN -->
		<div id="main">
			<?php $result = Banque::getListAllBanque(); ?>              
			<div id="main2">
                <table id='resultTab' class='bilan'>
                    <tr class='header'>
                        <th style="width: 125px;">Nom Banque</th>
                        <th style="width: 100px;">Total Capital</th>
                        <th style="width: 200px;">Total Prime Assurance</th>
                        <th style="width: 125px;">Total Comission</th>
                    </tr>
                    <?php 
                    	// DEBUG
						$cumulTotalAssure = 0;
						$cumulTotalComission = 0;
						$cumulTotalCotisation = 0;
						
                        for ($index = 0; $index < count($result); $index++) {
						$banque = $result[$index];
						$cumulTotalCotisation = $cumulTotalCotisation + $banque->getTotalPrimeAssurance();
						$cumulTotalComission = $cumulTotalComission + $banque->getTotalCommissionBanque();
						$cumulTotalAssure = $cumulTotalAssure + $banque->getTotalMontantAssure();
                    ?>
                    <tr onmouseover="this.className='highlight'" onmouseout="this.className='normal'">
                        <td style="width: 125px;" align="left"><?php echo $banque->nom; ?></td>
                        <td style="width: 125px;"><?php echo $banque->getTotalMontantAssure(); ?></td>
                        <td style="width: 100px;"><?php echo $banque->getTotalPrimeAssurance(); ?></td>
                        <td style="width: 200px;"><?php echo $banque->getTotalCommissionBanque(); ?></td>
                    </tr>
                    <?php } ?>
                    <tr class='total'>
                        <td style="width: 125px;"><b>TOTAL</b></td>
                        <td style="width: 125px;"><b><?php echo $cumulTotalAssure; ?></b></td>
                        <td style="width: 100px;"><b><?php echo $cumulTotalCotisation; ?></b></td>
                        <td style="width: 200px;"><b><?php echo $cumulTotalComission; ?></b></td>
                    </tr>
                </table>
			</div>
		</div>
		<!-- FOOTER -->
        <?php include_once'./include/footer.php'; ?>
    </body>
</html>

        
        
               